<?php
require_once("../config/sohu_config.php");
require_once("SohuOAuth.php");

function sohu_get_username($access_token)
{
	$oauth_token = $access_token['oauth_token'];
	$oauth_token_secret = $access_token['oauth_token_secret'];
	$oauth_obj = new SohuOAuth(CONSUMER_KEY, CONSUMER_SECRET, $oauth_token, $oauth_token_secret);
	
	$content = $oauth_obj->get("http://api.t.sohu.com/users/show.json");
	
	return $content->screen_name;
}

function sohu_add_weibo($access_token, $content)
{
	$oauth_token = $access_token['oauth_token'];
	$oauth_token_secret = $access_token['oauth_token_secret'];
	$oauth_obj = new SohuOAuth(CONSUMER_KEY, CONSUMER_SECRET, $oauth_token, $oauth_token_secret);
	
	$url = "http://api.t.sohu.com/statuses/update.json";
	$data = array('status' => urlencode($content));
	
	$ret = $oauth_obj->post($url, $data);
	return $ret;
}
?>